package com.xzy.generic.bad.example.b;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;

/**
 * 事件监听器
 *
 * @author xzy.xiao
 * @date 2023/2/28  20:03
 */
class BbbEventListener {

    Logger logger = LoggerFactory.getLogger(BbbEventListener.class);

    @EventListener
    public void onBbbEvent(GenericEvent genericEvent) {

        Class<?> clazz = genericEvent.getClazz();
        if (clazz == BbbData.class) {
            logger.info("监听到事件：{}", genericEvent);
            BbbData bbbData = (BbbData) clazz.cast(genericEvent.getEventData());
            // TODO:
        }
    }
}
